		//初始化文件数
		var initFileNum = 0;
		function getAllFileNum(){
			return initFileNum;
		}
		function updateAllFileNum(i){
			initFileNum += i;
		}
		//生成UUID
		function uuid() {
		    var s = [];
		    var hexDigits = "0123456789abcdef";
		    for (var i = 0; i < 36; i++) {
		        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
		    }
		    s[14] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
		    s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01
		    s[8] = s[13] = s[18] = s[23] = "-";
		 
		    var uuid = s.join("");
		    return uuid;
		}
		//刷新页面
		function refresh(){
			location.reload();
		}
		//修改顶部按钮可用性
		function forbitTopBtn(status){
			$(".title-left").each(function(){
				$(this).children("input").attr("disabled", status); 
			});
		}
		//创建文件列表标题
		function createHeader(){
			var header = "<ul class='list-cols'>"
    			+"<li class='li-header' style='width:50%'>"
    			+"<input type='checkbox' id='selectedAll' name='selectedAll' class='checkbox'/>"
    			+"<span>文件名</span>"
    			+"</li>"
			    +"<li class='li-header' style='width:18%'>大小</li>"
			    +"<li class='li-header' style='width:32%'>修改日期</li>"
   				+"</ul>";
   				return header;
		}
		
		//创建新的一行
		function createRow(){
			var newRow = "<div class='item'>"
				+"<div class='folder' style='width:50%'>"
				+"<input type='checkbox'  name='selectedFolder' class='checkbox'/>"
				+"<input type='hidden'  name='folderId'/>"
				+"<img src='images/folder.png' width='30' height='30' />"
				+"<input type='text' id='newFolder"+i+"' name='newFolder"+i+"' value='新建文件夹' autofocus onfocus='this.select()'/>"
				+"<img src='images/insure.png' id='insure"+i+"' width='21.6' height='21.6' />"
				+"<img src='images/cancel.png' id='cancel"+i+"' width='21.6' height='21.6' />"
				+"<select name='viewPermissions' class='viewPermission' style='display:none'>"
				+"	<option value='0'>隐私</option>"
				+"	<option value='1'>好友可见</option>"
				+"	<option value='1'>公开</option>"
				+"</select>"
				+"<img src='images/rename.png' class='rename' width='15' height='15' onclick='rename(this)' style='display:none'/>"
				+"</div>"
				+"<div class='folder' style='width:14%'>"
				+"<span></span>"
				+"</div>"
				+"<div class='folder' style='width:36%'>"
				+"<span></span>"
				+"</div>";
    		return newRow;
		}
		
		
		//获得basePath
		function getBasePath(){
			var location = (window.location+'').split('/');
			var basePath = location[0]+'//'+location[2]+'/'+location[3];
			return basePath;
		}
		
		//获得已选择的文件夹数
		function getSelectedFolder(){
			var selectedFolderLength = $("input[name='selectedFolder']:checked").length;
			return selectedFolderLength;
		}
		
		//获得已选择的文件数
		function getSelectedFile(){
			var selectedFileLength = $("input[name='selectedFile']:checked").length;
			return selectedFileLength;
		}

		//获得页面的所有文件夹和文件数数
		function getAllFolderAndFile(){
			return $("input[name='selectedFolder']").length+$("input[name='selectedFile']").length;
		}
		
		//获得用户选择的所有文件夹和文件数数
		function getAllSelectedFolderOrFile(){
			return getSelectedFolder()+getSelectedFile();
		}
		
		function getAllSelectedUser(){
			return $("input[name='selectedUser']:checked").length;
		}
		function checkUpload(){
			var flag = true;
			if($("input[name='upload']").val().length == 0){
				alert("请先选择文件！");
				flag = false;
			}
			return flag;
		}
		
		//检查是否选中文件夹或文件
		function checkSelectedFolderOrFile(){
			if(getAllSelectedFolderOrFile() == 0){
				alert("至少选择一个文件夹或文件！");
				return false;
			}
			return true;
		}
		
		//校验文件夹名称，若存在向相同的在文件夹名称后加(?)
		function validateFolderName(newFolderName){
			var existFolderNum = 0;
			
			$(".folderSpan").each(function(){
				var bracketsIndex = ($(this).text()).indexOf('(');
				//如果已存在括号，表示还有其他的前缀名称相同的文件夹
				if(bracketsIndex > 0){
					var prefixStr = ($(this).text()).substring(0,($(this).text()).indexOf('(')).trim();
					if(prefixStr == newFolderName.trim()){
						existFolderNum++;
					}
				}
				else if(newFolderName == ($(this).text()).trim()){
					existFolderNum++;
				}
			});
			if(existFolderNum >=  1){
				return newFolderName +"("+existFolderNum+")";
			}
			return newFolderName;
		}
		
		//检查是否选中用户
		function checkUser(){
			var len = $("input[name='selectedUser']:checked").length;
			if(len <= 0){
				alert("请选择用户！");
				return false;
			}
			return true;
		}
